package com.fanqwz.hexieshe.domain.usercase;

import com.fanqwz.hexieshe.domain.Article;
import com.fanqwz.hexieshe.domain.executor.PostExecutionThread;
import com.fanqwz.hexieshe.domain.repository.Repository;

import java.util.concurrent.Executor;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * Created by fanqw on 2017/6/29.
 */

public class GetArticleUseCase extends UseCase<Article, GetArticleUseCase.Params> {
    private final Repository repository;

    @Inject
    GetArticleUseCase(Repository repository, Executor threadExecutor, PostExecutionThread postExecutionThread) {
        super(threadExecutor, postExecutionThread);
        this.repository =  repository;
    }

    @Override
    Observable<Article> buildUseCaseObservable(Params params) {
        return repository.article(params.articleID);
    }

    public static final class Params {
        public long articleID;
        public Params(long id) {
            articleID = id;
        }
    }
}
